package com.yt.app.provider.service.impl;

import com.yt.app.core.interfaces.AppTopicFavService;
import com.yt.app.core.model.AppTopicFav;
import com.yt.app.provider.dao.AppTopicDao;
import com.yt.app.provider.dao.AppTopicFavDao;
import com.yt.core.service.GenericServiceImpl;

import javax.annotation.Resource;

public class AppTopicFavServiceImpl extends GenericServiceImpl<AppTopicFav, Long> implements AppTopicFavService {
	private AppTopicFavDao dao;
	private AppTopicDao appTopicDao;

	public AppTopicDao getAppTopicDao() {
		return appTopicDao;
	}

	public void setAppTopicDao(AppTopicDao appTopicDao) {
		this.appTopicDao = appTopicDao;
	}

	public AppTopicFavServiceImpl() {
	}

	public AppTopicFavServiceImpl(AppTopicFavDao dao) {
		super(dao);
		this.dao = dao;
	}

	@Override
	public void insertFav(AppTopicFav fav) {
		this.dao.insert(fav);
		appTopicDao.increateFavNum(fav.getTopicId());
	}
}
